﻿using DesignMode.BuilderMode.Examples;
using DesignMode.BuilderMode.Examples.Component.Impl;
using DesignMode.BuilderMode.Examples.Component;

namespace DesignMode.BuilderMode
{
    /// <summary>
    /// 建造者
    /// </summary>
    public class BikeBuilder : IBikeBuilder
    {
        /// <summary>
        /// 第一种建造者模式
        /// </summary>
        private Bike mBike = new Bike();

        public IBikeBuilder BuildFrame()
        {
            IFrame frame = new AlloyFrame(); // 合金
            mBike.frame = frame;
            return this;
        }

        public IBikeBuilder BuildSeat()
        {
            ISeat seat = new DermisSeat(); // 真皮
            mBike.seat = seat;
            return this;
        }

        public IBikeBuilder BuildTire()
        {
            ITire tire = new SolidTire(); // 结实的
            mBike.tire = tire;
            return this;
        }

        public Bike Build()
        {
            return mBike;
        }
    }
}
